<template>
  <div>
    <el-button size="mini" type="text" @click="to">
      {{ btnText }}
    </el-button>
    <eForm ref="form" :sup-this="supThis" :is-add="false" :is-view="isView" :is-verify="isVerify" />
  </div>
</template>
<script>
import eForm from './form'
export default {
  components: { eForm },
  props: {
    isView: {
      type: Boolean,
      required: true
    },
    isVerify: {
      type: Boolean,
      required: false
    },
    data: {
      type: Object,
      required: true
    },
    supThis: {
      type: Object,
      required: true
    }
  },
  computed: {
    btnText() {
      if (this.isVerify) {
        return '审核'
      } else if (this.isView) {
        return '详情'
      } else {
        return '编辑'
      }
    }
  },
  methods: {
    to() {
      const _this = this.$refs.form
      _this.form = {
        id: this.data.id,
        seproCode: this.data.seproCode || this.data.code,
        seproId: this.data.seproId,
        seproItemName: this.data.seproItemName,
        seproRefeName: this.data.seproRefeName,
        seproName: this.data.seproName,
        postalCode: this.data.postalCode,
        address: this.data.address,
        contact: this.data.contact,
        email: this.data.email,
        phone: this.data.phone,
        companyItemId: this.data.companyItemId,
        companyItemName: this.data.companyItemName,
        registeredCapital: this.data.registeredCapital,
        head: this.data.head,
        serviceScope: this.data.serviceScope,
        serviceContent: this.data.serviceContent,
        remark: this.data.remark,
        state: this.data.state,
        inviteCode: this.data.inviteCode,
        lisence: this.data.lisence
      }
      _this.dialog = true
    }
  }
}
</script>

<style scoped>
  div{
    display: inline-block;
    margin-right: 3px;
  }
</style>
